iT邦幫忙

2023 iThome 鐵人賽

DAY 3
0
自我挑戰組

簡易跨平台記事白板系列 第 3

[Day 3] [flutter] multi-platform white board -- Create page

  • 分享至 

  • xImage
  •  

Preface

I plan to change the platform everyday, just to prove that it can work properly on every platform. Also I can recover any issue when any multi-platform problem occurs.

Begin

We finished most of the homepage, So i plan to lay out the create_note page.
To achieve this, Just define two Text controller for observing and controlling input.
After that, Pass them into the TextformField widget and decorate it

  final titleController = TextEditingController();
  final noteController = TextEditingController();
  
              TextFormField(
              controller: titleController,
              style: const TextStyle(
                fontSize: 28
              ),
              decoration: const InputDecoration(
                border: InputBorder.none,
                hintText: "Title"a
              ),
            ),
            const SizedBox(height: 10,),
            TextFormField(
              controller: noteController,
              style: const TextStyle(
                fontSize: 18
              ),
              decoration: const InputDecoration(
                border: InputBorder.none,
                hintText: "note"
              ),
            ),

Create a Note object
Once the Note object has been created, it is passed to the onNoteCreated callback function. This function is most likely defined in the parent widget and is used to handle the creation of the note.
add a listener to update App Bar title concurrently on titleController changed
last: put a floating action button for saving notes, add a check to ensure the title and notes are not empty.

img demo

code link

the view & editing is on tomorrow
I'm very tired today :(
thx for reading


上一篇
[Day 2] [flutter] multi-platform white board -- windows desktop
下一篇
[Day 4] [flutter] multi-platform white board -- view and editing page
系列文
簡易跨平台記事白板12
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言